From ad393f4243a10f9a5ab0ecd8afa5e6c07a088f5d Mon Sep 17 00:00:00 2001
From: eug-vs <eugene@eug-vs.xyz>
Date: Sun, 23 Oct 2022 01:30:18 +0300
Subject: feat: add pre-render hook

---
 src/pages/[...path].tsx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'src/pages/[...path].tsx')

diff --git a/src/pages/[...path].tsx b/src/pages/[...path].tsx
index 9f55cf8..cf5db8c 100644
--- a/src/pages/[...path].tsx
+++ b/src/pages/[...path].tsx
@@ -29,12 +29,14 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {
     : [context.params?.path]
   );
 
-  const markdownSource = await benzinConfig.adapter.getMarkdownSource(benzinConfig.CDN, path);
+  const originalSource = await benzinConfig.adapter.getMarkdownSource(benzinConfig.CDN, path);
+  const sourceWithHooks = await benzinConfig.hooks.preRender(path, originalSource, benzinConfig.adapter, benzinConfig.CDN);
+
   const emojiFileNames = await benzinConfig.adapter.getEmojiFileNames(benzinConfig.CDN, benzinConfig.paths.emojiRoot);
 
   return {
     props: {
-      markdownSource,
+      markdownSource: sourceWithHooks,
       emojiFileNames,
       path,
     }
-- 
cgit v1.2.3

